package com.bidevalution.dao.mapper;

import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.Param;

import com.bidevalution.dao.entity.BeExpertVoteResult;

public interface BeExpertVoteResultMapper {
    int deleteByPrimaryKey(String seqId);

    int insert(BeExpertVoteResult record);

    int insertSelective(BeExpertVoteResult record);

    BeExpertVoteResult selectByPrimaryKey(String seqId);

    int updateByPrimaryKeySelective(BeExpertVoteResult record);

    int updateByPrimaryKey(BeExpertVoteResult record);
    
    int deleteBySectionId(String sectionId);
    
    /**
     * 获取当前标段的投标结果信息
     * @param sectionId
     * @return
     */
    List<Map<String,String>> getVoteResultList(@Param("sectionId") String sectionId,@Param("voteType")String voteType);

    /**
     * 根据标段id统计已投票的专家数量
     * @param sectionId
     * @return
     */
    int countBySectionId(@Param("sectionId") String sectionId,@Param("voteType")String voteType,@Param("submitCode")String submitCode);

    /**
     * 根据标段id删除投票结果信息
     * @param sectionId
     * @return
     */
    int delBySectionId(@Param("sectionId") String sectionId,@Param("voteType")String voteType,@Param("submitCode")String submitCode);
    /**
     * 获取当前登录账号的投票结果信息
     * @param sectionId
     * @param loginName
     * @return
     */
    BeExpertVoteResult selectByExpertId(@Param("sectionId") String sectionId, @Param("expertId") String expertId,
                                        @Param("voteType")String voteType,@Param("submitCode")String submitCode);

    List<Map<String, Object>> getVoteResultDetailList(@Param("sectionId") String sectionId, @Param("voteType") String voteType,
                                                      @Param("submitCode") String submitCode);

    /**
     * 获取当前登录账号的投票结果信息（用于重评）
     *
     * @param beExpertVoteResult
     * @return
     */
    BeExpertVoteResult queryResultByExpertId(BeExpertVoteResult beExpertVoteResult);

    /**
     * 统计投票结果，可用于重评和替补
     *
     * @param sectionId
     * @param voteType
     * @param submitCode
     * @return
     */
    List<Map<String, Object>> queryVoteResult(@Param("sectionId") String sectionId, @Param("voteType") String voteType, @Param("submitCode") String submitCode);

    /**
     * 查询得票最多的专家
     * @param sectionId 标段id
     * @return 返回得票最高的信息
     */
    Map<String, Object> getMaxVotedExpert(@Param("sectionId") String sectionId);
}